[exporterhelper] Preserve request span context in the persistent queue#13188
[exporterhelper] Preserve request span context in the persistent queue#13188dmitryax merged 5 commits intoopen-telemetry:mainfrom
Conversation
45a9ea4 to
2a88aec
Compare
e6a73fa to
2dab304
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13188 +/- ##
==========================================
+ Coverage 91.27% 91.53% +0.26%
==========================================
Files 514 520 +6
Lines 28857 28918 +61
==========================================
+ Hits 26340 26471 +131
+ Misses 1998 1929 -69
+ Partials 519 518 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
82fe8ac to
864743e
Compare
ff34a4c to
63bfbd1
Compare
c0525c3 to
3ab99cb
Compare
04af594 to
572e5c9
Compare
572e5c9 to
a057af0
Compare
bogdandrutu
left a comment
There was a problem hiding this comment.
The only downside is that I don't see how to extend this to preserve other parts from the context (configured somehow).
Let's merge and iterate over a possible version to have instead of context a map[string]string? Or maybe add options to Marshal/Unmarshal and accept some helpers that will return "key/value" and accept "key/value" when re-constructing the context?
| message RequestContext { | ||
| // Span context encoded using W3C trace context format. | ||
| // This map typically includes "traceparent" and optionally "tracestate" keys. | ||
| map<string, string> span_context_map = 1; |
There was a problem hiding this comment.
Map is pretty expensive, can keep a list of message {key, value} since this is not exposed to the users.
and add `make genproto` to the diff check
…13216) Resolves #13188 (review) This also required moving to gogoproto to reuse existing opentelemetry.proto.common.v1.KeyValue message. Benchmarks: ``` goos: darwin goarch: arm64 pkg: go.opentelemetry.io/collector/pdata/xpdata/request cpu: Apple M1 Max before: BenchmarkEncodeDecodeContext-10 519790 2278 ns/op 1376 B/op 22 allocs/op after: BenchmarkEncodeDecodeContext-10 747158 1600 ns/op 661 B/op 18 allocs/op ```
This change makes it possible to propagate span context through the Collector with enable persistent queue.
Currently, it is behind the exporter.PersistRequestContext feature gate, which can be enabled by adding
--feature-gates=exporter.PersistRequestContextto the collector command line. An exporter buffer stored by a previous version of the collector (or by a collector with the feature gate disabled) can be read by a newer collector with the feature enabled. However, the reverse is not supported: a buffer stored by a newer collector with the feature enabled cannot be read by an older collector (or by a collector with the feature gate disabled).Resolves #11740
Alternative to #13176 that doesn't involve custom encoder but exposes new public module
pdata/xpdata/requestThe actual change set is pretty small. Most of the code is generated protobuf